Socket
Socket
Sign inDemoInstall

import-modules

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

import-modules

Import all modules in a directory


Version published
Weekly downloads
385K
decreased by-1.1%
Maintainers
1
Weekly downloads
 
Created

What is import-modules?

The import-modules npm package is designed to dynamically import all modules from a specified directory. This can be particularly useful for loading multiple modules without having to manually require each one, streamlining the process of module management in Node.js applications.

What are import-modules's main functionalities?

Import all modules from a directory

This feature allows you to import all modules from a specified directory. The `importModules` function takes the path to the directory as an argument and returns an object containing all the modules in that directory.

const importModules = require('import-modules');
const modules = importModules('path/to/directory');
console.log(modules);

Filter modules by file extension

This feature allows you to filter the modules by file extension. By passing a filter option, you can specify which files to include, such as only JavaScript files.

const importModules = require('import-modules');
const jsModules = importModules('path/to/directory', { filter: '**/*.js' });
console.log(jsModules);

Custom module key

This feature allows you to customize the keys of the imported modules. By setting the `camelize` option to false, the keys will not be camelized, preserving the original file names.

const importModules = require('import-modules');
const modules = importModules('path/to/directory', { camelize: false });
console.log(modules);

Other packages similar to import-modules

Keywords

FAQs

Package last updated on 20 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc